package com.qf.entity;

import java.util.List;

/**
 * @Author:YuhuaZhang
 * @Description
 * @Date:Created in 9:51 2021/11/5
 * @Modified By:
 */
public class PageBean<T> {
    private List<T> list;
    /**
     * 当前页数
     */
    private int currentPage;
    /**
     * 每页显示数量
     */
    private int pageSize;
    /**
     * 总条数
     */
    private long totalCount;
    /**
     * 总页数
     */
    private int totalPage;

    public PageBean(List<T> list, int currentPage, int pageSize, long totalCount) {
        this.list = list;
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }

    public int getTotalPage() {
        //向上取整方法获取总页数
        return (int) Math.ceil(totalCount*1.0/pageSize);
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }
}
